package com.netintech.intelligenceInterface.iflytek.controller;

import com.netintech.intelligenceInterface.iflytek.domain.textIntentionClassification.SingleTextIntentionClassificationParam;
import com.netintech.intelligenceInterface.iflytek.domain.textIntentionClassification.TextIntentionClassificationMultiParam;
import com.netintech.intelligenceInterface.iflytek.util.HeadersUtil;
import com.netintech.intelligenceInterface.iflytek.util.RestTemplateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import static com.netintech.intelligenceInterface.common.StaticBean.URL1;

/**
 * @author lining
 * @date 2021/4/27 16:36
 * 文本意图分类接口
 */
@RestController
public class TextIntentionClassificationController {

    /**
     * 单文本意图分类路径
     */
    private static final String SINGLE_TEXT_INTENTION_CLASSIFY_URL = "/tuling/tic/v2/singlclassify";
    /**
     * 多文本意图分类路径
     */
    private static final String MULTI_TEXT_INTENTION_CLASSIFY_URL = "/tuling/tic/v2/muticlassify";

    @PostMapping("singleTextClassify")
    public String singleTextClassify(@RequestBody SingleTextIntentionClassificationParam param) {
        String url = URL1 + SINGLE_TEXT_INTENTION_CLASSIFY_URL;
        return RestTemplateUtil.getRestTemplateResult(url, param);
    }

    @PostMapping("/test/singleTextClassify")
    public String singleTextClassifyTest(@RequestBody SingleTextIntentionClassificationParam param) {
        String url = URL1 + SINGLE_TEXT_INTENTION_CLASSIFY_URL;
        return RestTemplateUtil.getRestTemplateResult(url, param);
    }

    @PostMapping("multiTextClassify")
    public String multiTextClassify(@RequestBody TextIntentionClassificationMultiParam param) {
        String url = URL1 + MULTI_TEXT_INTENTION_CLASSIFY_URL;
        return RestTemplateUtil.getRestTemplateResult(url, param);
    }

    @PostMapping("/test/multiTextClassify")
    public String multiTextClassifyTest(@RequestBody TextIntentionClassificationMultiParam param) {
        String url = URL1 + MULTI_TEXT_INTENTION_CLASSIFY_URL;
        return RestTemplateUtil.getRestTemplateResult(url, param);
    }


}
